<template>
  <van-popup
    v-model:show="props.groupvisible"
    position="bottom"
    :overlay="true"
    @close="close"
  >
    <van-checkbox-group v-model="checked">
      <van-cell-group inset>
        <van-cell
          v-for="(item,index) in props.group"
          :key="index"
          clickable
        >
          <template #right-icon>
            <van-checkbox :name="item">
              {{ item.name }}
            </van-checkbox>
          </template>
        </van-cell>
      </van-cell-group>
    </van-checkbox-group>
  </van-popup>
</template>

<script setup lang="ts">
import { ref } from 'vue'
const checked: any = ref([])
const emit = defineEmits(['GroupDialog'])
const props = defineProps({
  group: {
    type: Object,
    required: true
  },
  groupvisible: {
    type: Boolean,
    required: true,
    default: false
  }
})

const close = async () => {
  emit('GroupDialog', checked.value)
}
// const onConfirm = async (val: any, index: any) => {
//   emit('GroupValue', val, index)
// }
</script>
